package com.xiaocg.interpreter;

public class InterpreterTest {

    public static void main(String[] args) {
        Context context = new Context();

        Variable a = new Variable("a");
        Variable b = new Variable("b");
        Variable c = new Variable("c");
        Variable d = new Variable("d");

        context.add(a,3);
        context.add(b,6);
        context.add(c,10);
        context.add(d,7);

        AbstractExpression expression = new Plus(a,new Plus(new Minus(b,c),d));
        int interpreter = expression.interpreter(context);
        System.out.println(expression+"="+interpreter);

    }
}
